<?php
	$id=$_GET["edit"];
	$accion = $_GET["Action"];
	
	if(empty($id)){
		$id = $_POST["HotelesDisponibles"];
		$accion = "Insertar";
	}

	$db=new DB();
	$query ="Select * from destino where Id_Destino='{$id}'";
	$r=$db->query($query);
	if($db->total()>0){
		$row=$db->getRow();
		$ResValues= array("{$row[2]}","$row[3]","$row[4]","{$row[5]}");
	}
	$db->close();
?>
<script language="javascript" src="../js/operadoraLib.js" type="text/javascript"></script>
<style type="text/css">@import url(../css/calendar.css);</style>
<form name="EditDes" method="post" action="Destinos.php">
<input type="hidden" id="editedId" name="editedId" value="<?php echo $id; ?>" />
<input type="hidden" id = "action" name="action" value="<?php echo $accion; ?>" />
<table border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
    	<td class="formtitle" colspan="4">Datos Destino</td>
    </tr>
    <tr>
    	<td class="formLabelRes">Nombre del Destino:&nbsp;</td>
  <td width="179" class="formInput">
       	<input type="text" name="NomDestino" id="NomDestino" size="30" value="<?php echo $ResValues[0];  ?>" />
        </td>
      <td class="formLabelRes">Estado</td>
      <td class="formInput"><?php createSelectEstados("estadoDes", $ResValues[1]); ?></td>
    </tr>
    <tr>
    	<td class="formLabelRes">Ciudad</td>
        <td class="formInput" style="white-space:nowrap;">
        	<input type="text" name="CiudadDes" id="CiudadDes" value="<?php echo $ResValues[2]; ?>" />
        </td>
        <td class="formLabelRes">Descripci&oacute;n</td>
        <td class="formInput">
        	<textarea id="DescripDes" name="DescripDes" rows="10" cols="30"><?php echo $ResValues[3]; ?></textarea>
        </td>
    </tr>
    
    <tr>
    	<td colspan="4" align="center">
        	<br />
            <input type="button" name="CancelarBtn" value="Cancelar" onClick="parent.location.replace('Destinos.php')" />
        	<input type="submit" name="ActualizarBtn" value="<?php echo $accion; ?>"/>
        </td>
    </tr>
</table>
</form>